package com.example.zzj.ziwuyundemo.adapter;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.zzj.ziwuyundemo.R;

import java.util.List;

import butterknife.InjectView;

/**
 * Created by zzj on 2016/11/22.
 */

public class MainAdapter extends FragmentPagerAdapter {
    List<Fragment> fragments;
    private List<String> mTitles;
    private List<View> viewList;

//    private int[] imgs = new int[]{R.mipmap.home_red,R.mipmap.answer_glay,R.mipmap.inquiry_glay,R.mipmap.message_glay};

    public MainAdapter(FragmentManager fm, List<Fragment> fragmentList, List<String> titles, List<View> viewList) {
        super(fm);
        this.fragments = fragmentList;
        this.mTitles = titles;
        this.viewList = viewList;
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    @Override
    public int getCount() {
        return fragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mTitles.get(position);
    }

    public View getTabView(int position) {
        return viewList.get(position);
    }
}
